﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using Dapper;
using Core;
using System.Threading;
using System.Net;

namespace DAL
{
    public class ReStudentClassRecordDAL : SyncBase<Model.ReStudentClassRecord>
    {
        static ReStudentClassRecordDAL()
        {
            StringBuilder strSql = new StringBuilder();
            ReStudentClassRecordDAL.addSQL = @"insert into ReStudentClassRecord(StudentID,LessionID,StartTime,TimePoint,SactionCode,SactionResource,SactionContent)
                                                                        values (@StudentID,@LessionID,@StartTime,@TimePoint,@SactionCode,@SactionResource,@SactionContent);";
            ReStudentClassRecordDAL.tbName = "ReStudentClassRecord";
            ReStudentClassRecordDAL.remoteUrl = "/Ayyfford/AddStudentClassRecord";
            ReStudentClassRecordDAL.setVal = (lt) =>
            {
                StringBuilder sb = new StringBuilder();
                string _ids = string.Empty;
                if (lt != null && lt.Count > 0)
                {
                    lt.ForEach(t =>
                    {
                        _ids += t.ID + ",";
                        sb.AppendFormat("({0},{1},{2},{3},{4},{5},{6}),",
                            t.StudentID.NullNumber(), t.LessionID.NullNumber(), t.StartTime.NullDate(), t.TimePoint.NullNumber(), t.SactionCode.NullString(), t.SactionResource.NullNumber(), t.SactionContent.NullString());

                    });
                }
                return new Tuple<string, string>(sb.ToString(), _ids);
            };
        }

        new public static void SaveEntity(Model.ReStudentClassRecord t)
        {
            SyncBase<Model.ReStudentClassRecord>.SaveEntity(t);
        }

        new public static void AsyncData()
        {
            SyncBase<Model.ReStudentClassRecord>.AsyncData();
        }
    }
}

